package com.fable.sp.core.domain;

import com.alibaba.fastjson.annotation.JSONField;
import com.fable.sp.core.util.JSONType;
import org.hibernate.annotations.Type;

import javax.persistence.*;
import java.util.List;

/**
 * .
 *
 * @author stormning on 16/7/30.
 */
@Entity
@Table(name = "sp_layout_item", indexes = {@Index(columnList = "layout_id")})
public class LayoutItem extends StyleEntity {

    @Column(name = "layout_id")
    private Long layoutId;

    @Type(type = JSONType.TYPE)
    @Column(name = "config", length = 100000)
    @Lob
    private LayoutItemConfig config;

    @Transient
    @JSONField(serialize = false)
    private List<LayoutItemContent> contents;

    public Long getLayoutId() {
        return layoutId;
    }

    public void setLayoutId(Long layoutId) {
        this.layoutId = layoutId;
    }

    public LayoutItemConfig getConfig() {
        return config;
    }

    public void setConfig(LayoutItemConfig config) {
        this.config = config;
    }

    public List<LayoutItemContent> getContents() {
        return contents;
    }

    public void setContents(List<LayoutItemContent> contents) {
        this.contents = contents;
    }
}
